// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// +                                                                      +
// + This file is part of enGrid.                                         +
// +                                                                      +
// + Copyright 2008-2014 enGits GmbH                                      +
// +                                                                      +
// + enGrid is free software: you can redistribute it and/or modify       +
// + it under the terms of the GNU General Public License as published by +
// + the Free Software Foundation, either version 3 of the License, or    +
// + (at your option) any later version.                                  +
// +                                                                      +
// + enGrid is distributed in the hope that it will be useful,            +
// + but WITHOUT ANY WARRANTY; without even the implied warranty of       +
// + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        +
// + GNU General Public License for more details.                         +
// +                                                                      +
// + You should have received a copy of the GNU General Public License    +
// + along with enGrid. If not, see <http://www.gnu.org/licenses/>.       +
// +                                                                      +
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#ifndef OPTIMISENORMALVECTOR_H
#define OPTIMISENORMALVECTOR_H

class OptimiseNormalVector;

#include "optimisation.h"
#include "egvtkobject.h"

class OptimiseNormalVector : public Optimisation, public EgVtkObject
{

  QList<vec3_t> m_Constraints;
  QList<vec3_t> m_Faces;
  bool          m_UseGrouping;
  double        m_GroupingAngle;

protected: // methods

  virtual double func(vec3_t n);

public:

  OptimiseNormalVector(bool use_grouping = false, double grouping_angle = 0.0);

  virtual vec3_t optimise(vec3_t n);

  void addFace(vec3_t n);
  void addConstraint(vec3_t n);
  vec3_t operator()(vec3_t n);

};

#endif // OPTIMISENORMALVECTOR_H
